import java.net.*;
import java.io.*;

public class server
{
 public static void main(String args[])
 {
  boolean connected = true;
  try
  {
   //创建socket对象
   ServerSocket ss = new ServerSocket(2009);
   int clientnum = 0;
   
    while(connected)
   {
    ServerThread st = new ServerThread(ss.accept(), clientnum);
    st.start();
    clientnum++;
    System.out.println(clientnum);
   }
  }
    
  catch(ConnectException e)
   {
   System.out.println("异常"+e);
  }
 }
}
